package com.xywy.bloodandroid.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.xywy.bloodandroid.R;
import com.xywy.bloodandroid.base.BasicAdapter;
import com.xywy.bloodandroid.bean.PlusAsk;


public class DoctorQuestionRepalyAdapter extends BasicAdapter<PlusAsk> {
	private List<PlusAsk> list;
	private LayoutInflater inflater;
	public DoctorQuestionRepalyAdapter(Context context, List<PlusAsk> list) {
		super(context, list);
		this.list = list;
		this.context = context;
		this.inflater = LayoutInflater.from(context);
	}
  @Override
public View getView(int position, View convertView, ViewGroup parent) {
	  viewHolder holder;
	  if(convertView==null){
		  holder=new viewHolder();
		 convertView = inflater.inflate(R.layout.item_asking_detail, null);
		 holder.ask_flag=(TextView) convertView.findViewById(R.id.ask_flag);
		 holder.asking_content=(TextView) convertView.findViewById(R.id.asking_content);
		 convertView.setTag(holder);
	  }else{
		  holder=(viewHolder) convertView.getTag();
	  }
	  
	  int i=list.size()-(position+1);
		  if(list.get(i).getIs_r()==0){
			  holder.ask_flag.setText("追问");
			  holder.asking_content.setText(list.get(i).getPlusString());
		  }else if(list.get(i).getIs_r()==1){
			  holder.ask_flag.setText("回答");
			  holder.asking_content.setText(list.get(i).getPlusString());
		  }
	    return convertView;
}
  
  
  private  class  viewHolder{
	  private TextView ask_flag ;
	  private TextView  asking_content;
  }
}
